Avoid unnecessary work
authorJonas Bernoulli <jonas@bernoul.li>
Thu, 4 Aug 2022 12:05:12 +0000 (14:05 +0200)
committerJonas Bernoulli <jonas@bernoul.li>
Thu, 4 Aug 2022 12:05:12 +0000 (14:05 +0200)
which-key.el

index ba446a56737a437e902ae644845bb7f3af7ba08e..529cceb40a11ef1f9af31bc4861c21fd71cbb36d 100644 (file)
@@ -1589,12 +1589,12 @@ If KEY contains any \"special keys\" defined in
 
 (defsubst which-key--truncate-description (desc)
   "Truncate DESC description to `which-key-max-description-length'."
-  (let* ((last-face (get-text-property (1- (length desc)) 'face desc))
-         (dots (which-key--propertize which-key-ellipsis 'face last-face)))
-    (if (and which-key-max-description-length
-             (> (length desc) which-key-max-description-length))
-        (concat (substring desc 0 which-key-max-description-length) dots)
-      desc)))
+  (if (and which-key-max-description-length
+           (> (length desc) which-key-max-description-length))
+      (let* ((last-face (get-text-property (1- (length desc)) 'face desc))
+             (dots (which-key--propertize which-key-ellipsis 'face last-face)))
+        (concat (substring desc 0 which-key-max-description-length) dots))
+    desc))
 
 (defun which-key--highlight-face (description)
   "Return the highlight face for DESCRIPTION if it has one."